import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import router from './router.js';
import App from './App.vue';

import VueResource from 'vue-resource';
Vue.use(VueResource)

import jquery from 'jquery';
window.jquery = window.$ = jquery;
//公共过滤器文件
import * as filters from './assets/js/filters';
Object.keys(filters).forEach(key => {
	Vue.filter(key, filters[key])
})
// 引入vuex chenjw
import store from './store'
// 引入axios chenjw
// import axios from 'axios';
// Vue.use(axios);
// 引入 api到全局 chenjw
import api from './request/api';

/* 全局变量  lcs 添加*/
import glo from './global.js'
Vue.prototype.$glo = glo;


// 点击链接跳转回顶部
router.beforeEach((to, from, next) => {
	if (!to.meta.keepAlive) {
		// chrome
		document.body.scrollTop = 0
		// firefox
		document.documentElement.scrollTop = 0
		// safari
		window.pageYOffset = 0
	}
	next()
})



Vue.config.productionTip = false
Vue.use(ElementUI);

const API = "47.56.107.186:9090/demo";

// Vue.prototype._API = API;
Vue.prototype.$api = api; // 将api挂载到vue的原型上 chenjw
new Vue({
	store,//使用store chenjw
	router,
	watch: {
		// '$route.path': function(newVal, oldVal) {
		// 	console.log(newVal + "新----------------旧" + oldVal)
			
		// },
		mounted: function() {
			//console.log(this.$route.path)
		}
	},
	render: h => h(App),
}).$mount('#app')
